// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

export interface PlayerItemInfo {   
    headIcon: cc.SpriteFrame
    playerName: string
    win: number
    bet: number
    rate: number


}
const {ccclass, property} = cc._decorator;

@ccclass
export default class SpaceRocketPlayerInfoItem extends cc.Component {

    
    @property(cc.Sprite)
    headIcon: cc.Sprite = null;
    @property(cc.Label)
    playerName: cc.Label = null;
    @property(cc.Label)
    winLab: cc.Label = null;
    @property(cc.Label)
    betLab: cc.Label = null;
    @property(cc.Label)
    rateLab: cc.Label = null;
    @property(cc.Node)
    rateSp: cc.Node = null;
    

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}
    init(info: PlayerItemInfo,showWin: boolean){
        this.headIcon.spriteFrame = info.headIcon;
        this.playerName.string = info.playerName;
        this.winLab.string = info.win.toFixed(2);
        this.betLab.string = info.bet.toFixed(2);
        this.rateLab.string = info.rate.toFixed(2);
        if(showWin){
            this.winLab.node.active = true;
            //this.betLab.node.active = false;
            this.rateLab.node.active = true;
            this.rateSp.active = true;
        }else{
            this.winLab.node.active = false;
            //this.betLab.node.active = true;
            this.rateLab.node.active = false;
            this.rateSp.active = false;
        }
    } 


    start () {

    }

    // update (dt) {}
}
